import { defineStore } from 'pinia'

interface PermissionState {
  permissions: string[]
}

export const usePermissionStore = defineStore({
  id: 'permission',
  state: (): PermissionState => ({
    permissions: []
  }),
  
  actions: {
    setPermissions(permissions: string[]) {
      this.permissions = permissions
    },
    
    hasPermission(permission: string): boolean {
      return this.permissions.includes(permission)
    }
  }
})